package com.foreverwin.mes.core.websocket;

import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mes.core.utils.SpringUtil;
import org.apache.activemq.command.ActiveMQTopic;
import org.springframework.jms.core.JmsMessagingTemplate;

public class WebsocketUtil {

    public static void publishMessage( JSONObject message ){
        JmsMessagingTemplate jmsTemplate = SpringUtil.getBean( JmsMessagingTemplate.class );
        ActiveMQTopic topic = new ActiveMQTopic( "MES_WS_EVENT" );
        jmsTemplate.convertAndSend( topic, message );
    }
}
